<template>
  <div class="header">
    <div class="header-page">
      <div class="header-left" @click="onClickLeft"><van-icon name="arrow-left" /></div>
      <div class="header-tabs">
        <span @click="toScoreManagement" :class="{active: pathUrl == '/scoreManagement'}">积分管理</span>
        <span @click="toScoreRecord" :class="{active: pathUrl == '/scoreRecord'}">兑换记录</span>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'ScoreHeader',
  data (){
    return {
      pathUrl: this.$route.path
    }
  },
  created(){
  },
  methods: {
    onClickLeft(){
      this.$router.push({ path: '/index', query:{ token: this.$utils.SessionGet('token')}});
    },
    toScoreManagement(){
      this.$router.push({ path: '/scoreManagement'});
    },
    toScoreRecord(){
      this.$router.push({ path: "/scoreRecord"});
    }
  }
}
</script>
<style scoped lang="less">
@height: 48px;
.header{
  height: @height + 1;
  &-page{
    display: flex;
    width: 100%;
    height: @height;
    line-height: @height;
    position: fixed;
    background: #fff;
    text-align: center;
    border-bottom: 1px solid #ebedf0;
    z-index: 10;
  }
  &-tabs{
    font-size: 18px;
    font-weight: 700;
    flex: 1;
    span{
      display: inline-block;
      padding: 0 12px;
      line-height: @height;
      color: #999;
      &.active{
        position: relative;
        color: #000;
        &::after{
          position: absolute;
          bottom: 6px;
          left: 50%;
          margin-left: -12px;
          content: '';
          width: 24px;
          height: 4px;
          background: #51afb1;
        }
      }
    }
  }
  &-left{
    position: absolute;
    left: 0;
    padding: 0 12px;
    font-size: 21px;
    font-weight: 700;
  }
}
</style>
